<?php
/**
 * Description of User Asset Data
 *
 * @author Admin
 */
class Asset_Resource_Userassetdata extends WOW_Model_Resource_Db_Table_Abstract implements
Asset_Resource_Userassetdata_Interface
{
    protected $_name = 'user_assets_liabilities';
    protected $_primary = 'id';
    protected $_rowClass = 'Asset_Resource_Userassetdata_Item';

    protected $_dependentTables = array('Asset_Resource_Assetdetails');

/*    protected $_referenceMap = array(
        'Category' => array(
            'columns' => 'catid',
            'refTableClass' => 'Asset_Resource_Category',
            'refColumns' => 'catid',
        )
    );
*/
    
    public function getUserAssetDataByUserId($userid)
    {
        $select = $this->select()
                        ->setIntegrityCheck(false)
                        ->from('user_assets_liabilities', array('catid', 'subcatid', 'AssetCatLabelId'))
                        ->join('user_asset_details', 'user_assets_liabilities.id = user_asset_details.assetid', array('assetid','FormFieldId','FormFieldName', 'FormFieldValue' ))
                        ->where('user_assets_liabilities.user_id = ?', $userid);
         
        return $this->fetchAll($select);
    }
    
}
?>
